<include file="header"/>

<body>
<div class="wraper">
	<div class="head clearfix">
		<a href="javascript:history.go(-1);" class="iconfont icon-fanhui72 pull-left"></a>
		<span class="head-name pull-left">我的收藏</span>
	</div>
	<div class="margin-t">
		<volist name="data" id="vo">
			<if condition="$vo['goods']">
				<div class="white-block line-list{BEESCRM:$vo.collection_id}">
					<div class="tb-mode">
						<div class="tb-cell info-left">
							<div class="image-box">
								<img src="{BEESCRM:$vo.goods.goods_image}"/>
							</div>
						</div>
						<div class="tb-cell line-h">
							<p class="text-green">{BEESCRM:$vo.goods.goods_name}</p>
							<if condition="$vo['goods']['long_price']">
								<p class="sub-contain">长期摆放: {BEESCRM:$vo.goods.long_price} 元/盆/天</p>
							</if>
							<if condition="$vo['goods']['long_price']">
								<p class="sub-contain">会场布置：{BEESCRM:$vo.goods.meetingplace_price} 元/盆/场</p>
							</if>
						</div>
						<div class="tb-cell">
							<p class="pull-right"><a href="javascript:;" class="small-btn btn-blue cancle" data-id="{BEESCRM:$vo.collection_id}">取消</a></p>
						</div>
					</div>
				</div>
			</if>
		</volist>
		<input  type="hidden" id="collection_id"/>
	</div>
	<include file="nav"/>
</div>

<include file="commonJs"/>

<script>
	var nav_h = $('.nav').height();
	$('.wraper').css('paddingBottom',nav_h+8);
	var img_h = $('.image-box img').height();
	$('.image-box img').css('marginTop',-img_h/2);
	
	
	$(document).on('click','.cancle',function(){
		$('#collection_id').val($(this).data('id'));
    	$.confirm('确认取消收藏？', dothis);
    })
    
    function dothis(){
		var id = $('#collection_id').val();
    	var data = {'id':id};
    	$.ajax({
            type : 'json',
            method : 'post',
            url : "{BEESCRM::U('base/bonsai/cancelCollection', array('wechat_id'=>$wechat_id, 'origin'=>$origin))}",
            data : data,
           /*  beforeSend : function(){
            	$('.load').fadeIn(300);
            }, */
            success : function(data){
            	console.log(data);
            	var json = $.parseJSON(data);
                if(json.status == 'S'){
                	$('.line-list'+json.id).remove();
                	//$('.load').hide();
                	$.alert('success', json.message);
                }else{
                	//$('.load').hide();
                	$.alert('error', json.message);
                }
            },
            error:function(data){
            	//$('.load').hide();
            	$.alert('error','操作失败');
            }
        });
    }
</script>
</body>
</html>
